﻿Imports System.Data
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Globalization

Public Class AddSell

    Dim objConn As OracleConnection
    Dim cmd As OracleCommand
    Dim Udone As New Err
    Dim Done As New Done
    Dim infor As New infor

    Private Sub Bt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt1.Click
        Me.Close()
    End Sub

    Private Sub ADD2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ADD2.Click
        If TextBox5.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "" Or TextBox8.Text = "" Then
            infor.ShowDialog()
        Else
            Dim strConnString As String = Login.strConn
            objConn = New OracleConnection(strConnString)
            Dim cmd As New OracleCommand

            Dim str1 As String = ""
            Dim str2 As String = ""
            Dim str3 As String = ""
            Dim str4 As String = ""

            str1 = TextBox5.Text
            str2 = TextBox6.Text
            str3 = TextBox7.Text
            str4 = TextBox8.Text

            Try
                Dim sql As String = "Insert into SELLER VALUES('" + str1 + "','" + str2 + "','" + str3 + "','" + str4 + "')"
                objConn.Open()
                With cmd
                    .Connection = objConn
                    .CommandText = sql
                    .CommandType = CommandType.Text
                End With
                Try
                    cmd.ExecuteNonQuery()
                    Done.ShowDialog()
                Catch ex As Exception
                    Udone.ShowDialog()
                End Try
            Catch ex As Exception
                Udone.ShowDialog()
            Finally
                objConn.Dispose()
                TextBox5.Text = ""
                TextBox6.Text = ""
                TextBox7.Text = ""
                TextBox8.Text = ""
            End Try
        End If      
    End Sub
End Class